package net.wofly.sale.exchange.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import net.wofly.sale.exchange.repository.ExchangeConsumeRepository;
import net.wofly.sale.exchange.domain.ExchangeConsume;
import net.wofly.sale.exchange.service.IExchangeConsumeService;

@Service("iExchangeConsumeService")
@Transactional
public class ExchangeConsumeServiceImpl implements IExchangeConsumeService {

	@Autowired
	ExchangeConsumeRepository exchangeConsumeRepository;

	@Override
	public ExchangeConsume save(ExchangeConsume entity) {
		return exchangeConsumeRepository.save(entity);
	}

	@Override
	public void delete(ExchangeConsume entity) {
		exchangeConsumeRepository.delete(entity);
	}

	@Override
	public void delete(String key) {
		exchangeConsumeRepository.delete(key);
	}

	@Override
	public ExchangeConsume findOne(String key) {
		return exchangeConsumeRepository.findOne(key);
	}

	@Override
	public List<ExchangeConsume> save(List<ExchangeConsume> entityList) {
		return (List<ExchangeConsume>) exchangeConsumeRepository.save(entityList);
	}

	@Override
	public Page<ExchangeConsume> findAll(Specification specification, Pageable pageable) {
		return exchangeConsumeRepository.findAll(specification, pageable);
	}

	@Override
	public Page<ExchangeConsume> findAll(Pageable pageable) {
		return exchangeConsumeRepository.findAll(pageable);
	}
}
